package org.jeeasy.common.core.handler;

import lombok.RequiredArgsConstructor;
import org.dromara.mpe.annotation.handler.IAutoFillHandlerForBaseEntity;
import org.jeeasy.common.core.service.CurrentAuthUserService;
import org.springframework.stereotype.Component;

import java.lang.reflect.Field;

/**
 * @author wei.yang
 * @date 2025-01-15
 */
@Component
@RequiredArgsConstructor
public class UserIdAutoFillHandler implements IAutoFillHandlerForBaseEntity<String> {


    private final CurrentAuthUserService currentAuthUserService;

    @Override
    public String getVal(Object object, Class<?> clazz, Field field) {
        return currentAuthUserService.getCurrentAuthUser().id();
    }
}
